{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=3317
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var
	i,n,kk,k,m,x,y:longint;
	a:array[0..400010] of int64;
	b:array[0..100010] of int64;
	ans:int64;
	ch:char;
 
function build(n:longint):longint;
begin
k:=1;
result := 0;
while k<n do begin
	inc(result,k);
	k:=k shl 1;
end;
end;
 
procedure print();
 
var
	i,j,t,cur:longint;
 
begin
writeln;
t := 1;
cur := 1;
for i:=1 to trunc(Log2(k)) + 1 do begin
	for j:=1 to t do begin
		write(a[cur],' ');
		inc(cur);
	end;
	writeln;
	t:=t shl 1;
end;
end;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
for i:=1 to n do
	read(b[i]);
kk:=build(n);
for i:=1 to n do
	a[kk + i] := b[i];
for i:=kk downto 1 do
	a[i] := a[i * 2] + a[i * 2 + 1];
 
//print();
 
readln(m);
for i:=1 to m do begin
	read(ch);
	readln(x,y);
	if ch = 'u' then begin
		inc(x,kk);
		a[x] := y;
		x := x shr 1;
		while x >= 1 do begin
			a[x] := a[x * 2] + a[x * 2 + 1];
			x := x shr 1;
		end;	
		//print();
	end else begin
		inc(x,kk);
		inc(y,kk);
		ans := 0;
		while y > x do begin
			if odd(x) then begin
				inc(ans, a[x]);
				inc(x);
			end;
			if not odd(y) then begin
				inc(ans, a[y]);
				dec(y);
			end;
			x := x shr 1;
			y := y shr 1;	
		end;
		if x = y then inc(ans, a[x]);
		write(ans,' ');
	end;
end;
end.